package com.leonzx.base.service.system;

import com.leonzx.base.dao.system.MenuDataDAO;
import com.leonzx.base.entity.system.MenuData;
import com.leonzx.base.service.BaseService;
import com.leonzx.base.utils.UUIDUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @Author:chen
 * @Description:
 * @Date: 2018-07-02 13:47
 */
@Service
public class MenuDataService extends BaseService {

    @Autowired
    private MenuDataDAO menuDataDAO;

    public void saveMenuData(String json, String userId){
        menuDataDAO.delByUerId(userId);
        MenuData menuData = new MenuData();
        menuData.setId(UUIDUtils.getUUID());
        menuData.setUserId(userId);
        menuData.setMenuData(json);
        menuData.setCreateTime(new Date());
        menuData.setCreateUserId(userId);
        menuDataDAO.insert(menuData);
    }

}
